package easy;

import java.util.HashMap;
import java.util.Map;

public class Solution_1346 {

    public boolean checkIfExist(int[] arr) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            map.put(arr[i], i);
        }
        for (int i = 0; i < arr.length; i++) {
            int v = arr[i] << 1;
            if (map.containsKey(v) && map.get(v) != i) {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Solution_1346 model = new Solution_1346();
        System.out.println(model.checkIfExist(new int[]{10, 2, 5, 3}));
        System.out.println(model.checkIfExist(new int[]{7, 1, 14, 11}));
        System.out.println(model.checkIfExist(new int[]{3, 1, 7, 11}));
        System.out.println(model.checkIfExist(new int[]{5, 11, -19, -18, 19, 17}));
        System.out.println(model.checkIfExist(new int[]{-2, 0, 10, -19, 4, 6, -8}));
    }
}
